/*!
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *
 *    Author: flareguner
 *    E-Mail: flareguner@gmail.com
 *    Years: 2010-2011
 */


#ifndef TRANSLATIONCONFIG_H
#define TRANSLATIONCONFIG_H

#include <QtGui/QWidget>
#include "iface_settings.h"

class QCheckBox;
class QComboBox;
class QLineEdit;
class QVBoxLayout;
class QHBoxLayout;


class TranslationConfig : public QWidget, Iface_settings
{
    Q_OBJECT
public:
    explicit TranslationConfig(QWidget *parent = 0);
    ~TranslationConfig();

    bool getAutoTranslate() const;
    bool getAutoDetect() const;
    bool getScanSelection() const;
    bool getAutoCopy() const;
    bool getSimplifyResult() const;
    bool getModifierEnabled() const;
    QKeySequence getTranslationModifier() const;
    bool getHotkeyEnabled() const;
    QKeySequence getTranslationHotkey() const;


    void save();
    void read();
    void truncate();
public slots:
    void setAutoTranslate(bool);
    void setAutoDetect(bool);
    void setScanSelection(bool);
protected:
    void changeEvent(QEvent *);
    bool eventFilter(QObject *, QEvent *);
private:
    //! Methods
    void createUi();
    //! Data
    QCheckBox
    *autoTranslate,
    *autoDetect,
    *scanSelection,
    *autoCopy,
    *simplifyResult,
    *enableModifier,
    *enableHotkey;

    QHBoxLayout
    *modifiersLayout,
    *hotkeyLayout;

    QVBoxLayout *mainLayout;

    QComboBox *modifiersComboBox;
    QLineEdit *hotkeyLine;

    static const bool
    m_default_auto_translate,
    m_default_copy_text,
    m_default_auto_detect,
    m_default_simplify_result,
    m_default_scan_selection,
    m_default_modifier_enabled,
    m_default_hotkey_enabled;

    static const int
    m_default_modifier_index;

    static const QKeySequence
    m_default_hotkey;
};


#endif // TRANSLATIONCONFIG_H
